<template>
  <div>
    <el-card style="margin-top: 10px">
      <el-form :inline="true">
        <el-form-item label="商品名称">
          <el-input v-model="orderDetailName" placeholder="商品"></el-input>
        </el-form-item>
        <el-form-item label="店铺">
          <el-input v-model="storeId" placeholder="店铺"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="gettableData()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="orderDetailName" label="商品名称"></el-table-column>
        <el-table-column prop="orderDetailRepertory" label="购买商品库存"></el-table-column>
        <el-table-column prop="orderDetailPrice" label="购买商品单价"></el-table-column>
        <el-table-column prop="orderDetailWeight" label="购买商品重量"></el-table-column>
        <el-table-column prop="orderDetailIntroduce" label="商品介绍"></el-table-column>
        <el-table-column prop="productId" label="商品类别id"></el-table-column>
        <el-table-column label="购买类型">
          <template v-slot="scope">
            <el-tag type="success" v-if="scope.row.orderDetailStatus === 0">认领</el-tag>
            <el-tag type="success" v-if="scope.row.orderDetailStatus === 1">直购</el-tag>
            <el-tag type="success" v-if="scope.row.orderDetailStatus === 2">认领和直购</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="spellGroupNumber" label="拼团人数"></el-table-column>
        <el-table-column prop="spellGroupPrice" label="拼团价格"></el-table-column>
        <el-table-column prop="orderDetailSales" label="销量"></el-table-column>
        <el-table-column label="是否支持七天无理由退货">
          <template v-slot="scope">
            <el-tag v-if="scope.row.salesReturn === 0">不支持</el-tag>
            <el-tag v-if="scope.row.salesReturn === 1">支持</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="storeId" label="店铺id"></el-table-column>
        <el-table-column label="操作" width="180px">
          <template v-slot="scope">
            <el-button type="primary" plain size="mini" @click="TowShangShen(scope.row.storeId)">审核通过</el-button>
            <el-button type="primary" size="mini" @click="TowShangShenNo(scope.row.storeId)">审核不通过</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>

  </div>
</template>

<script>
  import Api from '@/api/audit/auditDetail'
export default {
  data(){
    return{
      tableData:[],
      orderDetailName:'',
      storeId:'',
    }
  },
  created() {
    this.gettableData()
  },
  methods:{
    gettableData(){
      Api.gettableData(this.orderDetailName,this.storeId)
        .then(res=>{
          console.log(res)
          this.tableData = res.data.list
        })
    },
    TowShangShen(orderDetailId){
      Api.TowShangShen(orderDetailId)
        .then(res=>{
          this.gettableData()
          this.$notify.success({
            title: '审核通过',
          });
        })
    },
    TowShangShenNo(orderDetailId){
      Api.TowShangShenNo(orderDetailId)
        .then(res=>{
          this.gettableData();
          this.$notify.error({
            title: '审核未通过',
          });
        })
    }
  }
}
</script>

<style>

</style>
